package com.yhp.service;

import com.github.pagehelper.PageInfo;
import com.yhp.utils.PagedGridResult;

import java.util.List;

public class BaseService {

    protected   PagedGridResult setPagedGrid(List<?> list, Integer page){
        PageInfo<?> pageInfo = new PageInfo<>(list);
        PagedGridResult pagedGridResult = new PagedGridResult();
        pagedGridResult.setPage(page);//设置页码值
        pagedGridResult.setRows(list);//设置数据集合
        pagedGridResult.setTotal(pageInfo.getPages());//总页数
        pagedGridResult.setRecords(pageInfo.getTotal());//总条数
        return pagedGridResult;
    }
}
